How to overload function println?

Hi I have to make 

print variable

print "\n"

A lot of times so i decide to create new function. In DXL we can not create function with generic type so I tried to overload it.

void println(string stringValue)  {
    if(null stringValue) {
        print "null"
        print "\n"
    } else {
        print stringValue
        print "\n"
    }
}

void println(intValue)  {
    if(null intValue) {
        print "null"
        print "\n"
    } else {
        print intValue
        print "\n"
    }
}

 

print "------------>" "\n"
println (1)
print "------------>" "\n"

 

But as in real DXL life happens strange error appears:

-E- DXL: <Line:11> syntax error
-E- DXL: <Line:14> (println) already declared in this scope
-E- DXL: <Line:16> incorrect arguments for function (print)
-E- DXL: <Line:24> incorrect arguments for function (println)
-I- DXL: All done. Errors reported: 4. Warnings reported: 0.

 


Dinio - Tue Jan 05 07:38:23 EST 2016

Re: How to overload function println?
Mathias Mamsch - Tue Jan 05 08:18:53 EST 2016

It should be

...
  } else {
        print intValue "" // missing the quotes here
        print "\n"
    }
...

 

Re: How to overload function println?
Mathias Mamsch - Tue Jan 05 08:23:28 EST 2016

Mathias Mamsch - Tue Jan 05 08:18:53 EST 2016

It should be

...
  } else {
        print intValue "" // missing the quotes here
        print "\n"
    }
...

 

And you are missing the declaration

void println(int intValue) 

Re: How to overload function println?
Dinio - Tue Jan 05 09:36:12 EST 2016

Mathias Mamsch - Tue Jan 05 08:23:28 EST 2016

And you are missing the declaration

void println(int intValue) 

OK, intValue and when write the script with embeded DXL Exitor, you can see nothing and the space just gone.

Thanks,again.